package com.yunti.springboot.util;

import java.text.DecimalFormat;
import java.util.List;

public class NumUtils {

    static DecimalFormat decimalFormat = new DecimalFormat("0.00");

    public static String saveTwoPoint(double num){
        return decimalFormat.format(num);
    }

    public static double getAvg(List<Double> subItemScoreList) {
        double sum = 0;
        for (int i = 0; i < subItemScoreList.size(); i++) {
            sum += subItemScoreList.get(i);
        }
        return sum / subItemScoreList.size();
    }
}
